﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class coupon_print : FBasePage
{
    // Fields
    public Maticsoft.BLL.Coupon couponbll = new Maticsoft.BLL.Coupon();
    public Maticsoft.Model.Coupon couponmodel = new Maticsoft.Model.Coupon();
    public Maticsoft.BLL.Partner parbll = new Maticsoft.BLL.Partner();
    public Maticsoft.Model.Partner parmodel = new Maticsoft.Model.Partner();
    public Maticsoft.BLL.System sysbll = new Maticsoft.BLL.System();
    public Maticsoft.Model.System sysmodel = new Maticsoft.Model.System();
    public Maticsoft.BLL.Team teambll = new Maticsoft.BLL.Team();
    public Maticsoft.Model.Team teamodel = new Maticsoft.Model.Team();
    public Maticsoft.BLL.UserInfo userbll = new Maticsoft.BLL.UserInfo();
    public Maticsoft.Model.UserInfo usermodel = new Maticsoft.Model.UserInfo();

    // Methods
    public void GetCoupon(string id)
    {
        this.couponmodel = this.couponbll.GetModel(id);
        if (this.couponmodel != null)
        {
            this.usermodel = this.userbll.Getusername(base.UserName);
            this.teamodel = this.teambll.GetModel(Convert.ToInt32(this.couponmodel.Team_id));
            this.parmodel = this.parbll.GetModel(Convert.ToInt32(this.couponmodel.Partner_id));
            this.sysmodel = this.sysbll.GetModel(1);
        }
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (!(this.Page.User.Identity.IsAuthenticated && !(this.Page.User.Identity.Name == "")))
        {
            base.Response.Redirect("/account/Login.aspx");
        }
        if (base.Request["couponid"] != null)
        {
            this.GetCoupon(base.Request["couponid"].ToString());
        }
    }

}